<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<script>
//new
	function createPerson(name,sex){	
		this.name=name;
		this.sex=sex;
		this.showName=function(){
			alert(this.name)	
		};
		this.showSex=function(){
			alert(this.sex)	
		};
	}
	var p1=new createPerson('da','man');
	var p2=new createPerson('pansy','woman');
	p1.showName();
	p1.showSex();
	p2.showName();
	p2.showSex();
	


	//有new的时候
/*function show(){
	alert(this);	
};
show();	//window
new show();		//新创建的对象 object

*/
</script>
</body>
</html>
